package drds.global_transaction;

import drds.common.Author;

@Author(name = Authors.LI_YANG)
public class Client
{
    public   String registertGlobalTransaction()throws Exception{
        HessianFactory hessianFactory = new HessianFactory();
        TransactionService transactionService = (TransactionService) hessianFactory.get(TransactionService.class);
        String globalTransactionId = transactionService.registertGlobalTransaction();
        return globalTransactionId;
    }
    public   BranchTransactionInfo registerBranchTransaction(String globalTransactionId)throws Exception{
        HessianFactory hessianFactory = new HessianFactory();
        TransactionService transactionService = (TransactionService) hessianFactory.get(TransactionService.class);
        BranchTransactionInfo branchTransactionInfo = transactionService.registerBranchTransaction(globalTransactionId);
        System.out.println(branchTransactionInfo.getBranchTransactionTimeout());
        return branchTransactionInfo;

    }

}
